<?php
$user="root";
$password="123456";
$database="dp";

$link = mysql_connect('localhost', $user, $password);
if (!$link) {die('Not connected : ' . mysql_error());}

// make foo the current db
$db_selected = mysql_select_db($database, $link);
if (!$db_selected) {die ('Can\'t use foo : ' . mysql_error());}

//use mysqli need one_line


$prefix="bak_%";
$sql="show tables like '".$prefix."' ";
echo "now showing tables \n $sql \n" ;

$result=mysql_query($sql);
if($result){
	while ($row=mysql_fetch_row($result)) {	
		
		$sql="drop  table ".$row[0];
		$r=mysql_query($sql);
		
		if($r){
			echo "ok\t$sql\n";
		}else{
			echo "error\t$sql\n";
		}

	}
	echo " nothing to do \n has finished\n";
}else{
	echo "has finished\n";
}


mysql_close();


?>